<script type="text/javascript">
$(function () {
	$('#tabs').tabs();
	var url = '${contextPath}script/sys/emp.js';
	$.ajax({url:url, dataType:'script', cache:true,
		success: function(){
				addFilesUploadEvent_emp();
		}
	});
	$('#editEmpForm').find("input:checkbox, input:radio").not('input.ibtn').uniform();
});
function mouseOver(obj) {
	obj.find('.close').css('display','');
}
function mouseOut(obj) {
	obj.find('.close').css('display','none');
}
</script>

<#import "/freemarker/modeltype.ftl" as mt>
<#import "/freemarker/modeltype_entity.ftl" as mte>
<form id="editEmpForm">
	<div id="tabs" class="ui-tabs ui-widget ui-widget-content ui-corner-all">
		<ul>
			<li><a href="#tabs-1">雇员基本信息</a></li>
			<li><a href="#tabs-2">附件</a></li>
		</ul>
		<div id="tabs-1">
			<table class="table boo-table table-content">
				<tr>
					<td class="table-left">E-mail</td>
					<td>
						<input type="text" id="email" name="email" value="${(user.email)!''}" />
						<input type="hidden" id="code" name="code" value="${(user.code)!''}" />
					</td>
				</tr>
				<tr>
					<td class="table-left">姓名</td>
					<td><input type="text" id="realName" name="realName" value="${(user.realName)!''}" /></td>
				</tr>
				<tr>
					<td>性别</td>
					<td><@mt.ManOrFemale value=((user.sex)!false) r=true name='sex' d=false mc=false /></td>
				</tr>
				<tr>
					<td>QQ</td>
					<td><input id="qq" class="field" type="text" name="qq" value="${(user.qq)!''}"/></td>
				</tr>
				<tr>
					<td>电话</td>
					<td><input id="mobile" class="field" type="text" name="mobile" value="${(user.mobile)!''}"/></td>
				</tr>
				<tr>
					<td>生日</td>
					<td><input id="birthday" class="field" type="text" name="birthday" value="${(user.birthday)!''}" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'});"/></td>
				</tr>
				<tr>
					<td>入职时间1</td>
					<td><input id=entryTime class="field" type="text" name="entryTime" value="${(user.entryTime)!''}" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'});"/></td>
				</tr>
				<tr>
					<td class="table-left">所属机构</td>
					<td>
						<div class="input-group">
							<span class="btn-group">
								<input  name="on" id="on" value="${(user.on)!''}" class="form-control" size="10" type="text" readonly="readonly"  style="width: 130px;"/>
								<input type="hidden" name="oc" id="oc" value="${(user.oc)!''}" />
								<button class="btn btn-primary" type="button" title="选择该用户所属机构" onclick="javascript: selectOrgan_emp($('#oc').attr('id'), $('#on').attr('id'));"><i class="icon-search"></i></button>
								<button class="btn btn-danger" type="button" title="去除机构查询条件" onclick="javascript: $('#oc').val(''); $('#on').val('');"><i class=icon-remove></i></button>
							</span>
						</div>
					</td>
				</tr>
				<tr>
					<td class="table-left">角色</td>
					<td>
						<select class="uniformselect" name="rc" id="rc">
							<option value="0">无角色</option>
							<#list roles as role>
							<option value="${(role.code)!''}" <#if (user.rc == role.code)>selected="selected"</#if>>${(role.name)!'' }</option>
							</#list>
						</select>
					</td>
				</tr>
				<tr>
					<td class="table-left">是否管理员</td>
					<td><@mt.YesOrNo value=((user.isManager)!false) r=true name='isManager' d=false mc=false /></td>
				</tr>
				<tr>
					<td class="table-left">是否屏蔽</td>
					<td><@mt.YesOrNo value=((user.deleted)!false) r=true name='deleted' d=false mc=false /></td>
				</tr>
				<tr>
					<td style="color:red; font-weight:bold; text-align:center;" colspan="2">创建成功后，默认登录密码为：000000</td>
				</tr>
			</table>
		</div>
		<div id="tabs-2">
			<table class="table boo-table table-content">
				<tr>
					<div>附件:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="btn btn-info" id="uploadFilesBtn" href="javascript:;"> 上 传 </a></div>
					<td id="annexListTd" style="margin-top: 10px;">
						<#assign i = 0 />
						<#if (user.anList)??>
						<#list user.anList as ua>
							<div class="filter-table rep" style="text-align:center;" onmousemove="javascript:mouseOver($(this));" onmouseout="javascript:mouseOut($(this));">
								<input class="code" type="hidden" name="anList[${i}].code" value="${(ua.code)!''}"/>
								<input class="uc" type="hidden" name="anList[${i}].uc" value="${(ua.uc)!''}"/>
								<input class="name" type="hidden" name="anList[${i}].name" value="${(ua.name)!''}"/>
								<input class="size" type="hidden" name="anList[${i}].size" value="${(ua.size)!''}" />
								<input class="uuid" type="hidden" name="anList[${i}].uuid" value="${(ua.uuid)!''}" />
								<input class="ext" type="hidden" name="anList[${i}].ext" value="${(ua.ext)!''}" />
								<span>${(ua.name)!''}</span>
								<button class="close" style="display:none;color: red;" href="javascript:;" onclick="javascript:deleteSelectedItem_emp($(this));return false;">&times;</button>
								<br/><span class="title" style="width:300px;overflow:hidden; text-overflow:ellipsis;word-wrap:break-word;">
									<img src="${contextPath}upload/userAnnex/${(ua.uuid)!''}.${(ua.ext)!''}" style="width:200px;height:180px;"/>
								</span>	
							</div>
						<#assign i = i + 1/>
						</#list>
						</#if>
					</td>
				</tr>
			</table>
		</div>
		<div style="text-align:center;">
			<a href="#" class="btn btn-info" onclick="javascript:saveEmp_emp(); return false;"><i class="icon-save"></i>保存</a>
			&nbsp;&nbsp;&nbsp;&nbsp;
			<a href="#" class="btn btn-primary" onclick="javascript: sys_load_handle('emp'); return false;">取消</a>
		</div>
	</form>
</div>
<input type="hidden" id="mail_an_index" value="${i}" />
<div id="tempAnnexListDiv" style="display:none;text-align:center;">
	<div class="filter-table rep" style="text-align:center;" onmousemove="javascript:mouseOver($(this));" onmouseout="javascript:mouseOut($(this));">
		<input class="name" type="hidden" />
		<input class="size" type="hidden" />
		<input class="uuid" type="hidden" />
		<input class="ext" type="hidden" />
		<span class="filename"></span>
		<button type="button" class="close" data-dismiss="alert" onclick="javascript:deleteSelectedItem_emp($(this));return false;">&times;</button>
		<br/><span class="title" style="overflow:hidden; text-overflow:ellipsis;word-wrap:word-wrap;">
			<img class="uid"  style="width:200px;height:180px;"/>
		</span>
	</div>
</div>
